﻿using System;
using Character;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;

// Token: 0x0200020E RID: 526
public class H_GagUI : MonoBehaviour
{
	// Token: 0x06000E73 RID: 3699 RVA: 0x0005A7F4 File Offset: 0x000589F4
	private void Awake()
	{
		this.toggle.action.AddListener(new UnityAction<bool>(this.OnToggle));
	}

	// Token: 0x06000E74 RID: 3700 RVA: 0x0005A814 File Offset: 0x00058A14
	public void Setup(H_Scene h_scene)
	{
		this.h_scene = h_scene;
		this.mainRadioGroup.action.AddListener(new UnityAction<int>(this.ChangeMain));
		this.subRadioGroup.action.AddListener(new UnityAction<int>(this.ChangeSub));
		Female female = h_scene.mainMembers.GetFemale(0);
		Female female2 = null;
		if (h_scene.visitor != null)
		{
			female2 = (h_scene.visitor.GetHuman() as Female);
		}
		this.subRadioGroup.gameObject.SetActive(female2 != null);
		this.mainName.text = Female.HeroineName(female.HeroineID);
		this.mainRadioGroup.Change((int)female.GagType, false);
		if (female2 != null)
		{
			this.subRadioGroup.Change((int)female2.GagType, false);
			this.subName.text = Female.HeroineName(female2.HeroineID);
		}
	}

	// Token: 0x06000E75 RID: 3701 RVA: 0x0005A900 File Offset: 0x00058B00
	public void Refresh(H_Scene scene)
	{
		Female female = scene.mainMembers.GetFemale(0);
		Female female2 = null;
		if (scene.visitor != null)
		{
			female2 = (scene.visitor.GetHuman() as Female);
		}
		this.mainRadioGroup.Change((int)female.GagType, false);
		if (female2 != null)
		{
			this.subRadioGroup.Change((int)female2.GagType, false);
		}
	}

	// Token: 0x06000E76 RID: 3702 RVA: 0x0005A968 File Offset: 0x00058B68
	public void SetNameUI()
	{
		Female female = this.h_scene.mainMembers.GetFemale(0);
		Female female2 = null;
		if (this.h_scene.visitor != null)
		{
			female2 = (this.h_scene.visitor.GetHuman() as Female);
		}
		this.mainName.text = Female.HeroineName(female.HeroineID);
		if (female2 != null)
		{
			this.subName.text = Female.HeroineName(female2.HeroineID);
		}
	}

	// Token: 0x06000E77 RID: 3703 RVA: 0x0005A9E8 File Offset: 0x00058BE8
	private void OnToggle(bool flag)
	{
		this.root.gameObject.SetActive(flag);
	}

	// Token: 0x06000E78 RID: 3704 RVA: 0x0005A9FC File Offset: 0x00058BFC
	private void ChangeMain(int value)
	{
		SystemSE.Play(SystemSE.SE.CHOICE);
		Female female = this.h_scene.mainMembers.GetFemale(0);
		female.personality.gagItem = (GAG_ITEM)value;
		female.ChangeGagItem();
	}

	// Token: 0x06000E79 RID: 3705 RVA: 0x0005AA34 File Offset: 0x00058C34
	private void ChangeSub(int value)
	{
		SystemSE.Play(SystemSE.SE.CHOICE);
		Female female = null;
		if (this.h_scene.visitor != null)
		{
			female = (this.h_scene.visitor.GetHuman() as Female);
		}
		if (female != null)
		{
			female.personality.gagItem = (GAG_ITEM)value;
			female.ChangeGagItem();
		}
	}

	// Token: 0x04000EE5 RID: 3813
	private H_Scene h_scene;

	// Token: 0x04000EE6 RID: 3814
	[SerializeField]
	private ToggleButton toggle;

	// Token: 0x04000EE7 RID: 3815
	[SerializeField]
	private GameObject root;

	// Token: 0x04000EE8 RID: 3816
	[SerializeField]
	private RadioButtonGroup mainRadioGroup;

	// Token: 0x04000EE9 RID: 3817
	[SerializeField]
	private RadioButtonGroup subRadioGroup;

	// Token: 0x04000EEA RID: 3818
	[SerializeField]
	private Text mainName;

	// Token: 0x04000EEB RID: 3819
	[SerializeField]
	private Text subName;
}
